package com.shimao.celnet.payment.service.impl;

import com.shimao.celnet.payment.mapper.PPayDetailMapper;
import com.shimao.celnet.payment.model.PPayDetail;
import com.shimao.celnet.payment.service.PPayDetailService;
import com.shimao.celnet.payment.util.FinalUtil;
import org.apache.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 支付申请明细 信息 管理
 * Created by ensure on 2017/12/3.
 */
@Service
public class PPayDetailServiceImpl extends BaseServiceImpl<PPayDetail> implements PPayDetailService {
    protected Logger logger = Logger.getLogger(this.getClass());

    @Autowired
    private PPayDetailMapper pPayDetailMapper;

    /**
     *新增保存
     * @return
     */
    @Override
    public int save(PPayDetail sBean){
        int retCnt=0;
        String loginUserGuid = FinalUtil.INTER_FACE_USER_ID;
        sBean.setUpdateUserGuid(loginUserGuid);
        sBean.setCreatedUserGuid(loginUserGuid);
//        sBean.setGuid(getGuid());//guid
        retCnt = super.save(sBean);

        return retCnt;
    }

    /**
     *修改保存
     * @return
     */
    @Override
    public int update(PPayDetail sBean){
        String loginUserGuid = (String) SecurityUtils.getSubject().getSession().getAttribute("userSessionId");
        sBean.setUpdateUserGuid(loginUserGuid);
        int retCnt = super.update(sBean);

        return retCnt;
    }

    /**
     *批量保存
     * @return
     */
    @Override
    public void saveByBatchList(List<PPayDetail> pPayDetailList) {

        pPayDetailMapper.saveByBatchList(pPayDetailList);

    }
}
